package com.googlecode.tracey.ui;

import com.googlecode.tracey.ui.core.TraceyCoreModule;
import com.googlecode.tracey.ui.core.TraceyModuleDefinitions;
import com.googlecode.tracey.ui.demo.DemoModule;
import com.googlecode.utterlyidle.BasePath;
import com.googlecode.utterlyidle.RestApplication;
import com.googlecode.utterlyidle.modules.Module;

import static com.googlecode.totallylazy.URLs.packageUrl;
import static com.googlecode.utterlyidle.dsl.DslBindings.bindings;
import static com.googlecode.utterlyidle.dsl.StaticBindingBuilder.in;
import static com.googlecode.utterlyidle.modules.Modules.bindingsModule;

public class WebApplication extends RestApplication{
    public WebApplication(BasePath basePath, Module ...extensions) {
        super(basePath);
        add(new TraceyModuleDefinitions());
        add(new TraceyCoreModule());
        add(new DemoModule());
        add(bindingsModule(bindings(in(packageUrl(TraceyCoreModule.class)).path("static"))));
        for (Module extension : extensions) {
            add(extension);
        }
    }
}
